<!--

    Copyright 2010 Guadaltel, S.A.

    Licensed under the EUPL, Version 1.1 or - as soon they
    will be approved by the European Commission - subsequent
    versions of the EUPL (the "Licence");
    you may not use this work except in compliance with the
    Licence.
    You may obtain a copy of the Licence at:

    http://ec.europa.eu/idabc/eupl

    Unless required by applicable law or agreed to in
    writing, software distributed under the Licence is
    distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
    express or implied.
    See the Licence for the specific language governing
    permissions and limitations under the Licence.

-->
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:a="http://richfaces.org/a4j" template="layout/acceso.xhtml"
	xmlns:rich="http://richfaces.org/rich">

	<ui:define name="body">
		<body onload="cargarCliente();">
		<script>
			var signerClientMapBuild = 'COMPLETA';

			function finFirma(clientSignerResult){
				document.getElementById("clientSignerResult").value = clientSignerResult;
		    }
		</script>
		<script type="text/javascript" language="javascript"
			src="#{facesContext.externalContext.requestContextPath}/common-js/clientSigner.js"></script>
		<rich:panel id="accesoGtablon">
			<f:facet name="header">
				<h:outputText title="Acceso a G-TABLON" value="Acceso a G-TABLON" />
			</f:facet>
			<h:form id="certificateForm">
				<input type="hidden" id="clientSignerResult"
					name="clientSignerResult" />
				<input type="hidden" id="typeAuthentication"
					name="typeAuthentication" value="certificate" />
				<h:panelGrid columns="1">
					<a:commandButton value="ACCESO CON CERTIFICADO"
						onclick="JSON.stringify = function(value){return value.toJSON();};authenticate(${clientSignerConfig}, 'finFirma');"
						action="#{authenticator.acceder}" />
					<a:commandButton value="ACCESO"
						action="#{authenticator.entrarDirecto}" />
				</h:panelGrid>
				<a:jsFunction name="cargarCliente" reRender="certificateForm"
					actionListener="#{authenticator.cargarCliente}"></a:jsFunction>
			</h:form>
			<h:messages styleClass="centrado noPadding" />
		</rich:panel>
		</body>
	</ui:define>
</ui:composition>